<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateAttachmentTempFilesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('attachment_temp_files', function (Blueprint $table) {
            $table->increments('id')->comment('临时重要文件表 ID');
            $table->char('sha512', 128)->comment('文件哈希');
            $table->string('mime_type')->comment('文件 MIME 类型');
            $table->string('local_path')->comment('文件本地地址');
            $table->string('extension')->comment('文件扩展名');
            $table->string('original_name')->comment('原始名称');
            $table->integer('size')->unsgined()->comment('文件尺寸');
            $table->char('token', 60)->unqiue()->comment('令牌');
            $table->dateTime('expire')->comment('过期时间');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::drop('attachment_temp_files');
    }
}
